<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>微信绑定页面</title>
    <meta name="description" content="这是一个 index 页面">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="icon" type="image/png" href="/assets/i/favicon.png">
    <link rel="apple-touch-icon-precomposed" href="/assets/i/app-icon72x72@2x.png">
    <meta name="apple-mobile-web-app-title" content="Amaze UI" />
    <link rel="stylesheet" href="/assets/css/amazeui.min.css" />
    <link rel="stylesheet" href="/assets/css/amazeui.datatables.min.css" />
    <link rel="stylesheet" href="/assets/css/app.css">
    <script src="/assets/js/jquery.min.js"></script>
    <script src="/assets/js/theme.js"></script>
    <script src="/assets/js/amazeui.min.js"></script>
    <script src="/assets/js/app.js"></script>

</head>



<body data-type="login" class="theme-white">
<div class="am-g tpl-g" >
    <!-- 风格切换 -->

    <div class="tpl-login">
        <div class="tpl-login-content">
            <div class="tpl-login-logo">
                <img alt="" src="${headimgurl }" width="150px" height="150px">
            </div>
微信绑定页面
            <form class="am-form tpl-form-line-form">
                <div class="am-form-group">
                    <span>微信用户：${nickName }</span>
                </div>


                <div class="am-form-group">
                    <input type="text" class="tpl-form-input" id="username" placeholder="请输入账号">

                </div>

                <div class="am-form-group">
                    <input type="password" class="tpl-form-input" id="password" placeholder="请输入密码">

                </div>

                <div class="am-form-group">

                    <button type="button" class="am-btn am-btn-primary  am-btn-block tpl-btn-bg-color-success  tpl-login-btn" onclick="bind();">绑定</button>

                </div>
            </form>
        </div>
    </div>
</div>

<script src="/js/jquery.js"></script>
<script src="/js/theme.js"></script>
<script src="/js/amazeui.min.js"></script>
<script src="/js/amazeui.datatables.min.js"></script>
<script src="/js/dataTables.responsive.min.js"></script>
<script src="/js/app.js"></script>
<script src="/js/vue.js"></script>
<script src="/js/reconnecting-websocket.js"></script>
<script type="text/javascript" src="/js/dayuanit.js"></script>

<script type="text/javascript">


    function bind() {

        var param = {
            username : $('#username').val(),
            pwd : $('#password').val()
        };

        $.ajax({
            type: "GET",
            dataType: "json",
            url: '/wx/wxBind.do',
            data: param,
            success: function (dataResult) {
                if (1000 !== dataResult.code) {
                    alert(dataResult.message);
                    return false;
                }

                window.location.href = "/user/toHome.do";
            },
            error: function (XMLHttpResponse) {
            }
        });
    }

    function loadCaptcha() {
        $('#codeImg').attr('src', '/getCaptcha.do?xx=' + new Date().getTime());
    }

    function callback(data, status) {

        if (data.success) {
            window.location.href='/user/toUserCenter.do';
        } else {
            DY.alert(false, data.message);
        }

    }

</script>

</body>

</html>